package override;

class Business{
	public void dealwith() {
	}
}
class Chat extends Business{
	@Override
	public void dealwith() {
		System.out.println("现在开始处理聊天业务...");
	}
}
class Account extends Business{
	@Override
	public void dealwith() {
		System.out.println("现在开始处理转账务...");
	}
}
class FileTrans extends Business{
	@Override
	public void dealwith() {
		System.out.println("现在开始处理文件传送业务...");
	}
}
class User{
	public void useWeChat(Business bus) { // Business bus = c;
		//多态:父类的引用指向了子类对象，调用被子类重写的方法，从而实现多态
		bus.dealwith();
	}
}
public class Demo3 {
	public static void main(String[] args) {
		Chat c = new Chat();
		Account a = new Account();
		FileTrans ft = new FileTrans();
		
		User u = new User();
		u.useWeChat(c);
		u.useWeChat(a);
		u.useWeChat(ft);
	}
}
